package com.ruima.framework.rest;

import java.sql.SQLException;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;

import com.ruima.framework.db.impl.RmSysUserImpl;

@Path("RmSystemUserService")
public class RmSystemUserService {
	
	private static String SYSTEM_USER_JSON;
	
	private RmSysUserImpl rmSysUserImpl = new RmSysUserImpl();
	
	@GET
	@Produces(MediaType.TEXT_HTML)
	@Path("getrmsystemuserlist")
	/**
	 * 
	 *  "{\"result\":0}";
	 */
	public String getRmSystemUserList(){
		try {
			if(SYSTEM_USER_JSON==null){
				JsonConfig jc = new JsonConfig();
				jc.setExcludes(new String[]{});
				SYSTEM_USER_JSON = JSONArray.fromObject(rmSysUserImpl.getRmSysUsers(),jc).toString();
			}
			return "{\"identifier\":\"objid\",\"label\":\"objid\",\"items\":"+SYSTEM_USER_JSON+"}";
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "{\"result\":0}";
	}
	public static void main(String[] args) {
		new RmSystemUserService().getRmSystemUserList();
		
	}
}
